#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
void change(int a[], int b[], int sz) {
	int tmp;
	for (int n = 0; n < sz; n++)
	{
		tmp = a[n];
		a[n] = b[n];
		b[n] = tmp;
	}
}
void print(int a[], int sz) {
		for (int n = 0; n < sz; n++)
		{
			printf(" %d",a[n]);
		}
		printf("\n");
}
int main()
{
	int a[10], b[10], sz, n = 0;
	sz = sizeof(a) / sizeof(a[0]);
	while (n < sz)
	{
		scanf("%d", &a[n]);
		n++;
	}
	n = 0;
	while (n < sz)
	{
		scanf("%d", &b[n]);
		n++;
	}
	change(a, b, sz);
	print(a,sz);
	print(b, sz);
	return 0;
}